package org.xdq.demo.components;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;
import org.xdq.demo.components.impl.UDisk;

//此时放入容器中的对象是Usb对象，而不是MyFactoryBean对象，MyFactoryBean负责创建对象
@Component("ausb")
public class MyFactoryBean implements FactoryBean<Usb> {
    @Override
    public Usb getObject() throws Exception {
        return new UDisk(); //()-> System.out.println("Usb音乐播放器在工作。。。。。");
    }

    @Override
    public Class<?> getObjectType() {
        return Usb.class;
    }
}
